import 'package:fake_handwriting/generated/l10n.dart';
import 'package:flutter/material.dart';
class InputText extends StatefulWidget {
  const InputText({Key? key}) : super(key: key);
  @override
  State<StatefulWidget> createState() => InputTextPage();
}
class InputTextPage extends State<InputText> {
  final _controller=TextEditingController();
  @override
  void dispose() {
    _controller.dispose();
    super.dispose();
  }
  @override
  Widget build(BuildContext context) {
    String content = ModalRoute.of(context)?.settings.arguments as String;
    _controller.text=content;
    return Scaffold(
      body: SafeArea(
          child: Padding(
            padding: const EdgeInsets.all(15),
            child: Container(
              constraints: const BoxConstraints(
                  minHeight: double.infinity,),
              child: TextField(
                controller: _controller,
                maxLines: null,
                keyboardType: TextInputType.multiline,
                decoration: InputDecoration.collapsed(
                  hintText: S.of(context).pleaseEnterTheContent,
                ),
              ),
            ),
          ),
      ),
      appBar: AppBar(
        title: Text(S.of(context).pleaseEnterTheContent),
        actions: [
          IconButton(
            icon: const Icon(Icons.done),
            tooltip:S.of(context).finish,
            onPressed: () {
              Navigator.pop(context,_controller.text);
            },
          ),
        ],
      ),
    );
  }
}